home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / comms / other / ftransapiv / arexx / ftransib.ibrx < prev    next >
Text File  |  1999-06-14  |  3KB  |  119 lines

  1. /* 
  2.  
  3.  ----------------------------------------
  4.  IBrowse Translator By FTranslator Client
  5.  
  6.  Script by Cristian Robert Gallas
  7.  
  8.  Tested with IBrowse 1.22
  9.  Usage:                                 
  10.  Use in ARexx interface of IBrowse
  11.  $VER: FTransIB.ibrx v0.01 (14.08.96)
  12.  ----------------------------------------
  13.  
  14.  HISTORY
  15.  ----------------------------------------
  16.  v0.01b [14.08.98] - First public beta version.
  17.  ----------------------------------------
  18.  
  19.  [Steps installation]
  20.  
  21.  > Copy FTransIB.ibrx to IBROWSE:IBrx/
  22.  > Go to Preferences/General
  23.  > Select folder Rexx
  24.  > Click in ADD
  25.  > Name  -> Port->Eng (Example: Portuguese to English)
  26.  > Macro -> IBROWSE:IBrx/FTransIB.ibrx 3 (3 is a translation direction)
  27.  > Click OK
  28.  > Save preferences in Preferences/Save Settings
  29.  > Select text for translation
  30.  > Go to REXX Menu and select Port->Eng
  31.  > Wait for windows with translation :)
  32.  
  33.  0 - English   to Francais
  34.  1 - English   to Deutsch
  35.  2 - English   to Italiano
  36.  3 - English   to Portugues
  37.  4 - English   to Espanol
  38.  5 - Francais  to English
  39.  6 - Deutsch   to English
  40.  7 - Italiano  to English
  41.  8 - Espanol   to English
  42.  9 - Portugues to English
  43.  
  44. */
  45.  
  46. Options Results
  47.  
  48. tmpfile = 'Ram:FTransTmp.IB'
  49. tmpclip = 'Ram:FTransIB.Clip'
  50. sel = ''
  51.  
  52. ARG traduz
  53.  
  54. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  55. if ~show(l, "rexxsupport.library") then
  56.   if ~addlib("rexxsupport.library", 0, -30) then
  57.     exit
  58. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  59. if ~show(l, "rexxtricks.library") then
  60.   if ~addlib("rexxtricks.library", 0, -30) then
  61.     exit
  62.  
  63. saida = TestaPubScreen(pubscreenlist(screenlist))
  64.  
  65. /* TESTA SE O PROGRAMA JA NAO ESTA COM A PORTA DE TRADUCAO ABERTA */
  66. if exists(tmpfile) then do
  67.   Address Command 'echo "FTranslation port is open! Translation in progress, wait..." > "Ram:FT.echo.tmp"'
  68.   if saida = 0 then
  69.     Address Command 'Multiview PUBSCREEN IBROWSER "Ram:FT.echo.tmp"'
  70.   else
  71.     Address Command 'Multiview "Ram:FT.echo.tmp"'
  72.   call delete('Ram:FT.echo.tmp')
  73.   exit
  74. end
  75.  
  76. /* COLOCA COMO DEFAULT PORTUGUES TO ENGLISH */
  77. if traduz = "" then
  78.   traduz = 3
  79.  
  80. /* LE O CLIPBOARD */
  81. sel = ReadClipboard(0)
  82.  
  83. /* TESTA SE FOI MARCADO O TEXTO */
  84. if sel = '' then do
  85.   Address Command 'echo "You need select text first..." > 'tmpfile
  86.   if saida = 0 then
  87.     Address Command 'Multiview PUBSCREEN IBROWSER "'tmpfile'"'
  88.   else
  89.     Address Command 'Multiview "'tmpfile'"'
  90.   call delete(tmpfile)
  91.   exit
  92. end
  93.  
  94. call open(1, tmpclip, 'W')
  95. call writeln(1, sel)
  96. call close(1)
  97.  
  98. /* EXECUTA O FTRANSLATOR COM OS ARGUMENTOS DA TRADUCAO */
  99. comando = 'C:FTranslator FILE 'traduz' "'tmpclip'" SILENCE > 'tmpfile
  100. Address Command comando
  101. call delete(tmpclip)
  102.  
  103. if saida = 0 then
  104.   Address Command 'Amigaguide PUBSCREEN IBROWSER "'tmpfile'"'
  105. else
  106.   Address Command 'Amigaguide "'tmpfile'"'
  107.  
  108. call delete(tmpfile)
  109.  
  110. exit
  111.  
  112. /* TESTA SE O IBROWSER ESTA EM UMA JANELA PUBSCREEN */
  113. TestaPubScreen:
  114. Do i = 1 To screenlist.0
  115.   if Lower(screenlist.i) = 'ibrowser' then
  116.     return 0
  117. end
  118. return 1
  119.